//
//  GXDPDetCell.m
//  YaDiuDiu
//
//  Created by 欧洪飞 on 2017/8/24.
//  Copyright © 2017年 jy. All rights reserved.
//

#import "GXDPDetCell.h"

@implementation GXDPDetCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.amount = 0;
    self.images.contentMode = UIViewContentModeScaleAspectFill;
    self.images.layer.cornerRadius = 5;
    self.images.layer.masksToBounds = YES;
    
    [self.btnRelesa setHidden:YES];
    [self.labNum setHidden:YES];
    
    [self bringSubviewToFront:self.plusImageView];
}

- (IBAction)clickRelease:(id)sender {
    self.amount -= 1;
    
    //self.plusBlock(self.amount,NO);
    
    [self showOrderNumbers:self.amount];
    
}

- (IBAction)clickAdd:(id)sender {
    self.amount += 1;
    
    //self.plusBlock(self.amount,YES);
    
    [self showOrderNumbers:self.amount];
    
}

-(void)layoutSubviews
{
    [super layoutSubviews];
    
    [self showOrderNumbers:self.amount];
    
}


-(void)showOrderNumbers:(NSUInteger)count
{
    self.labNum.text = [NSString stringWithFormat:@"%lu",(unsigned long)self.amount];
    if (self.amount > 0)
    {
        [self.btnRelesa setHidden:NO];
        [self.labNum setHidden:NO];
    }
    else
    {
        [self.btnRelesa setHidden:YES];
        [self.labNum setHidden:YES];
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
